- name: make the app be real
  hosts: os_control[0]:os_control_stg[0]
  user: root
  gather_facts: False

  vars_files:
    - /srv/web/infra/ansible/vars/global.yml
    - "/srv/private/ansible/vars.yml"
    - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - role: openshift/project
    app: docsbuilding
    description: Documentation building
    appowners:
    - asamalik
    - jibecfed
    - dustymabe
    - pingou
    - darknao
    - pbokoc
    tags:
      - apply-appowners
      - appowners

  - role: openshift/imagestream
    app: docsbuilding
    imagename: builder

  - role: openshift/object
    app: docsbuilding
    objectname: buildconfig.yml
    template: buildconfig.yml

  - role: openshift/start-build
    app: docsbuilding
    buildname: builder-build

  - role: openshift/object
    app: docsbuilding
    template: cron.yml
    objectname: cron.yml
    tags:
      - deploy-cronjob

  - role: openshift/object
    app: docsbuilding
    template: cron-translated.yml
    objectname: cron-translated.yml
    tags:
      - deploy-cronjob

  - role: openshift/object
    app: docsbuilding
    file: pvc.yml
    objectname: pvc.yml


###############################################
# actions to delete the project from OpenShift
###############################################
# to run: sudo rbac-playbook -l os_masters_stg[0] -t delete openshift-apps/docsbuilding.yml
  - role: openshift/object-delete
    app: docsbuilding
    objecttype: cronjob
    objectname: cron
    tags: [ never, delete ]
  - role: openshift/object-delete
    app: docsbuilding
    objecttype: cronjob
    objectname: cron-translated
    tags: [ never, delete ]
